<?php
	$link = connect();
	if ($link['error']) {
		$sql = "select * from category where pid=0";
		$cates = query($link['mess'],$sql);
		//var_dump($cates);
	}
?>
<div class="head">
			<!--头部最上部分-->
			<div class="head1">
				<ul class="hul1">
					<li><a href="">华为官网</a></li>
					<li><a href="">荣耀官网</a></li>
					<li><a href="">软件应用</a></li>
					<li><a href="">花粉俱乐部</a></li>
					<li><a href="">Select Region</a></li>
				</ul>
				<ul class="hul2">
					<?php if(empty($_SESSION['username'])):?>
					<li><a href="http://localhost/project_VALL/web/login.php">登录</a></li>
					<li>|</li>
					<li><a href="http://localhost/project_VALL/web/register.php">注册</a></li>
					<?php else:?>
					<li>用户：<a href="" style="color:red; font-size:14px;"><?php echo $_SESSION['username']?></a></li>
					<li><a href="http://localhost/project_VALL/web/action?a=out">退出</a></li>
					<?php endif;?>
					<li><a href="
						<?php if(empty($_SESSION['username'])):?>
						<?php echo './login.php'?>
						<?php else:?>
						<?php echo 'http://localhost/project_VALL/web/orderdet/orderdet.php'?>
						<?php endif;?>
					">个人中心</a></li>
					<li><a href="">V码(优购码)</a></li>
					<li><a href="">手机版</a></li>
					<li><a href="">网站导航</a></li>
					<li><a href="
						<?php if(empty($_SESSION['username'])):?>
						<?php echo 'http://localhost/project_VALL/web/login.php';?>
						<?php else:?>
						<?php echo 'http://localhost/project_VALL/web/shopcar.php'?>
						<?php endif;?>
					">购物车</a></li>
				</ul>
			</div>
			<!--logo一栏部分-->
			<div class="head2">
				<div><img src="http://localhost/project_VALL/web/index/newLogo.png"></div>
				<!--搜索框-->
				<div class="search">
					<form>
						<input type="text" class="input" placeholder="荣耀6plus">
					</form>
					<a href=""><div class="searchdiv">搜索</div></a>
					<ul>
						<li>热门搜索：</li>
						<li><a href="">荣耀8</a></li>
						<li><a href="">P9</a></li>
						<li><a href="">mata8</a></li>
						<li><a href="">荣耀6plus</a></li>
						<li><a href="">r815t</a></li>
					</ul>
				</div>
				<!--头部二维码-->
				<img src="http://localhost/project_VALL/web/index/img67.png" class="imgewm">
				<span>微信关注我们</span>
			</div>
		</div>

		<div class="hmenu">
				<div class="hmenu1">全部商品</div>
				<ul>
					<?php foreach($cates as $val):?>
					<a href="<?php
						if($val['id'] != 1):?>
							<?php echo 'http://localhost/project_VALL/web/goodslist.blade.php?id='.$val['id'];?>
						<?php else:?>
							<?php echo 'http://localhost/project_VALL/';?>
						<?php endif;?>"><li><?php echo $val['name']?></li></a>
					<?php endforeach;?>
				</ul>
		</div> 